Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(CL): change full range definition #6380

Closed
wants to merge 6 commits into from

Conversation

p0mvn
Copy link
Member

@p0mvn p0mvn commented Sep 12, 2023

Closes:

What is the purpose of the change

Changes the notion of full range to the extended [10^-30, 10^30].

Refactors all remaining logic, including superfluid to utilize the new price range. Removes any previously added fuzzer restrictions. Changes DefaultMinTick to the V2 tick in tests.

Testing and Verifying

  • The majority of the changes here are covered by the existing tests. What gives the most confidence is fuzzer functioning without unexpected issues coming up.

Documentation and Release Note

  • Does this pull request introduce a new feature or user-facing behavior changes?
  • Changelog entry added to Unreleased section of CHANGELOG.md?

Where is the change documented?

  • Specification (x/{module}/README.md)
  • Osmosis documentation site
  • Code comments?
  • N/A

@p0mvn p0mvn force-pushed the roman/min-spot-price-cont branch from aa4d675 to 13a5552 Compare September 12, 2023 17:38
@p0mvn p0mvn added the V:state/breaking State machine breaking PR label Sep 12, 2023
Comment on lines 49 to 55
// Seed 1694529692 - proves issues in rounding direction of GetNextSqrtPriceFromAmount0InRoundingUp, proving
// that we must not QuoRoundUp for the last term in the formula.
// To repro: set up a breakpoint at the top of computeSwapOutGivenIn, and set count to 15.
// On the third (last) swap step for that swap, observe that the final `sqrtPriceNext` is off by one
// BigDec ULP, showing that this rounding bheavior was the issue.
r := rand.New(rand.NewSource(1694529692))
s.individualFuzz(r, 0, 30, 10)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see this seed.

If the change in #6379 is reverted, this will start running into infinite loop bugs.


// estimate the amount in to fund
amountZeroIn, _, _ := s.computeSwapAmounts(poolId, pool.GetCurrentSqrtPrice(), types.MinInitializedTick, true, false)
amountZeroIn, _, _ := s.computeSwapAmounts(poolId, pool.GetCurrentSqrtPrice(), types.MinInitializedTickV2, true, false)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done here

@p0mvn p0mvn force-pushed the roman/min-spot-price-cont branch from cacdf04 to cc63dd6 Compare September 14, 2023 11:51
@p0mvn
Copy link
Member Author

p0mvn commented Sep 14, 2023

Context on latest commit in the PR:

Still getting error that #6379 was attempting to get resolved.

The investigations have shown that this is an acceptable case where non-zero amount in would yield a zero amount out. So we can adjust our fuzzed to never hit such cases.

Fuzzer change is still WIP and needs more tweaking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:simulator Edits simulator or simulations C:x/concentrated-liquidity C:x/superfluid V:state/breaking State machine breaking PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant